namespace A1;

public record Order(int OrderId, Customer Customer, List<OrderDetails> OrderDetails)
{
    private Order(): this(0, null, null)
    {
        
    }
    public decimal TotalAmount => OrderDetails.Sum(item => item.Quantity * item.Product.Price);

    public override string ToString() =>
        $"Order ID: {OrderId}\n\t{Customer}\n\tItems: [{string.Join("\n\t       ", OrderDetails)}]\n\tTotal Amount: {TotalAmount:C}";

    public override int GetHashCode() => OrderId.GetHashCode();
}